Skip to content

fix: guard rename/update_url actions against empty remote list#2870

Merged
extrawurst merged 3 commits intogitui-org:masterfrom
xvchris:fix/remotelist-panic-no-remotes
Mar 19, 2026
Merged

fix: guard rename/update_url actions against empty remote list#2870
extrawurst merged 3 commits intogitui-org:masterfrom
xvchris:fix/remotelist-panic-no-remotes

Conversation

@xvchris
Copy link
Contributor

@xvchris xvchris commented Mar 4, 2026

This Pull Request fixes/closes #2868, #2869.

It changes the following:

  • Add valid_selection() guard to rename_remote event handler branch
  • Add valid_selection() guard to update_remote_url event handler branch
  • Add changelog entry under ## Unreleased### Fixes

These guards match the existing pattern on delete_remote, preventing an index-out-of-bounds panic when the remote list is empty.

I followed the checklist:

  • I added unittests — RemoteListPopup has no existing test infrastructure (new() requires full Environment); the fix is a 2-line guard addition matching the existing delete_remote pattern
  • I ran make check without errors
  • I tested the overall application
  • I added an appropriate item to the changelog

xvchris

This comment was marked as abuse.

xvchris

This comment was marked as abuse.

Copy link
Collaborator

@extrawurst extrawurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution. looks good to me. Please add a changelog entry and we are gtg

@extrawurst extrawurst added this to the v0.28.1 milestone Mar 5, 2026
@xvchris xvchris requested a review from extrawurst March 6, 2026 08:36
@xvchris xvchris force-pushed the fix/remotelist-panic-no-remotes branch 3 times, most recently from 30acb93 to 5bbe31f Compare March 6, 2026 08:46
@xvchris
Copy link
Contributor Author

xvchris commented Mar 8, 2026

Hi @extrawurst, the changelog entry was already added in commit 25ab784. Please take another look when you get a chance! 🙏

@xvchris
Copy link
Contributor Author

xvchris commented Mar 19, 2026

Hi! The changelog entry has already been added in the PR:

## Unreleased

### Fixes
* fix panic when renaming or updating remote URL with no remotes configured [[@xvchris](https://github.com/xvchris)] ([#2868](https://github.com/gitui-org/gitui/issues/2868))

Let me know if anything else is needed, happy to adjust!

Copy link
Collaborator

@extrawurst extrawurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

xvchris added 3 commits March 20, 2026 06:08
The rename_remote() and update_remote_url() event handlers in
RemoteListPopup did not check valid_selection() before indexing
into self.remote_names, causing a panic (index out of bounds)
when no remotes are configured.

The delete_remote() handler already had this guard. This commit
adds the same valid_selection() check to the other two handlers
for consistency.

Fixes gitui-org#2868
Fixes gitui-org#2869
@xvchris xvchris force-pushed the fix/remotelist-panic-no-remotes branch from e3ac866 to 14755a8 Compare March 19, 2026 22:09
@xvchris
Copy link
Contributor Author

xvchris commented Mar 19, 2026

Thanks for the review, @alerque! I've resolved the merge conflict in CHANGELOG.md — the branch was rebased onto the current master, incorporating the rust msrv bumped to 1.88 entry alongside our ### Fixed entry. No more conflict markers.

@extrawurst extrawurst merged commit 06a3f66 into gitui-org:master Mar 19, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GitUI crash in empty repo with no remotes

3 participants